//
//  ParserClass.m
//  Mecca
//
//  Created by Ryan Enguero on 5/21/14.
//  Copyright (c) 2014 TapDash Heuristics. All rights reserved.
//

#import "ParserClass.h"

#import "UserDetails.h"

#import "Artist.h"

#import "Album.h"

#import "Songs.h"

#import "DownloadedSongs.h"

#import "NewsFeed.h"

#import "TopDownloaded.h"

#import "Schedules.h"

#import "Photos.h"

#import "Favorites.h"

#import "Events.h"

#import "Comments.h"

#import "NewArtist.h"

#import "NewSongs.h"

#import "FeatureArtist.h"

#import "FeaturedSongs.h"

#import "HomeData.h"

#import "Downloading.h"

#import "PlayListData.h"

#import "ListenedSongs.h"


static ParserClass *sharedItem = nil;
NSInteger artistInt;
@implementation ParserClass


#pragma mark - User Details

- (NSArray*)userDetails{

    return userDetailsArr;
}

- (void)userDetails:(NSDictionary*)details{
    
    userDetailsArr = [NSMutableArray array];

    UserDetails *userDetails = [UserDetails userWithSessionID:[[[details objectForKey:@"User Details"] objectAtIndex:0] objectForKey:@"session_id"]
                                                   andContact:[[[details objectForKey:@"User Details"] objectAtIndex:0] objectForKey:@"user_contact"]
                                                   andCredits:[[[details objectForKey:@"User Details"] objectAtIndex:0] objectForKey:@"user_credits"]
                                               andDisplayName:[[[details objectForKey:@"User Details"] objectAtIndex:0] objectForKey:@"user_dname"]
                                                     andEmail:[[[details objectForKey:@"User Details"] objectAtIndex:0] objectForKey:@"user_email"]
                                                    andIdUser:[[[details objectForKey:@"User Details"]objectAtIndex:0] objectForKey:@"user_id"]
                                                     andImage:[[[details objectForKey:@"User Details"]objectAtIndex:0]  objectForKey:@"user_image"]
                                                  andPassword:[[[details objectForKey:@"User Details"]objectAtIndex:0] objectForKey:@"user_password"]];

    [userDetailsArr addObject:userDetails];


}

#pragma mark - Artist Details

- (NSArray*)artistDetails{

    return artistDetailsArr;
}

- (void)artistDetails:(NSDictionary*)details{
    
    artistDetailsArr = [NSMutableArray array];

    for (int i = 0; i < [[details objectForKey:@"Artist"] count]; i++) {
        
        Artist *artist = [Artist artistWithID:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Artist ID"]
                                  andFullname:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Full Name"]
                                andScreenName:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Screen Name"]
                               andDescription:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Description"]
                            andProfilePicture:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Profile Picture"]
                                     andCount:[[[details objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Album Count"]];
        
        
        [artistDetailsArr addObject:artist];
        
        artistInt = i;
    }

}

#pragma mark - Album Details

- (NSArray*)albumDetails{

    return albumDetailsArr;
}

- (void)albumDetails:(NSDictionary*)details{
    
    albumDetailsArr = [NSMutableArray array];

    //for (int i = 0; i < [[details objectForKey:@"Artist"] count]; i++) {
        
//        for (int j = 0; j < [[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] count]; j++) {
//            
//            Album *album = [Album albumWithID:[[[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album ID"]
//                                      andName:[[[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Name"]
//                               andreleaseDate:[[[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Release Date"]
//                                     andImage:[[[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Image"]
//                                   andArtisID:[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Artist ID"]
//                                    andCount:[[[[[details objectForKey:@"Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Song Count"]];
//            
//            [albumDetailsArr addObject:album];
//
//        }
    
    for (int j = 0; j < [[details objectForKey:@"Album"] count]; j++) {
        
        Album *album = [Album albumWithID:[[[details objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album ID"]
                                  andName:[[[details objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Name"]
                           andreleaseDate:[[[details objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Release Date"]
                                 andImage:[[[details objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Image"]
                               andArtisID:[details objectForKey:@"Artist ID"]
                                 andCount:[[[details objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Song Count"]];
        
        [albumDetailsArr addObject:album];
        
    }
    
    
   // }
}



- (NSArray*)albumFeautredArtistDetails{
    
    return albumDetailsArr;
}

- (void)albumFeautredArtistDetails:(NSDictionary*)details andIndex:(NSInteger)idx{
    
    albumDetailsArr = [NSMutableArray array];
    
    //for (int i = 0; i < [[details objectForKey:@"Artist"] count]; i++) {
    
    for (int j = 0; j < [[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] count]; j++) {
        
        Album *album = [Album albumWithID:[[[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album ID"]
                                  andName:[[[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Name"]
                           andreleaseDate:[[[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Release Date"]
                                 andImage:[[[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Album Image"]
                               andArtisID:[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Artist ID"]
                                 andCount:[[[[[details objectForKey:@"Featured Artist"] objectAtIndex:idx] objectForKey:@"Album"] objectAtIndex:j] objectForKey:@"Song Count"]];
        
        [albumDetailsArr addObject:album];
        
    }
    
    
    // }
}

#pragma mark - Song Details

- (NSArray*)songDetails{

    
    return songDetailsArr;
    
}

- (void)songDetails:(NSDictionary*)details{
    
    songDetailsArr = [NSMutableArray array];
    
    for (int i = 0; i < [[details objectForKey:@"Songs"] count]; i++) {
        
        Songs *song = [Songs songsWithID:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song ID"]
                                 andName:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Name"]
                             andLocation:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Location"]
                            andDurations:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Duration"]
                              andRatings:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Ratings"]
                            andDownloads:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Downloads"]
                                andLikes:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Likes"]
                               andShares:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Shares"]
                             andFileSize:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Size"]
                       andPrice:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Price"]
                          andSongPreview:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Preview"]
                               andLyrics:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Lyrics"]];
        
        
//        [self getImgStr:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album Image"]];
        
        [songDetailsArr addObject:song];
    }
    
}

- (NSString*)urlSong{

    return urlSongStr;
}

- (NSInteger)idxCount{

    return idxCountStr;
}

-(NSString *)fileSizeSong{

    return fileSizeStr;
}

- (NSString*) songPreview{

    return songPreviewStr;
}
- (void)getUrlSong:(NSString*)songUrl andCount:(NSInteger)idx andFileSize:(NSString*)fileSize andSongPreview:(NSString*)songPreview{
    
    urlSongStr = songUrl;
    idxCountStr = idx;
    fileSizeStr = fileSize;
    songPreviewStr = songPreview;
}

#pragma mark - Downloaded Songs

- (NSArray*)downloadedSongs{

    return dlSongsArr;
}

- (void)downloadedSongWithID:(NSMutableArray*)details{

    dlSongsArr = [NSMutableArray array];
    
    for (int i = 0; i < [details count]; i++) {
        DownloadedSongs *dlSong = [DownloadedSongs songsWithID:[[details objectAtIndex:i] objectForKey:@"id"]
                                                       andName:[[details objectAtIndex:i] objectForKey:@"name"]
                                                       andData:[[details objectAtIndex:i] objectForKey:@"data"]
                                                        andImg:[[details objectAtIndex:i] objectForKey:@"image"]
                                                   andDuration:[[details objectAtIndex:i] objectForKey:@"duration"]
                                                 andArtistName:[[details objectAtIndex:i] objectForKey:@"artistName"]
                                                  andAlbumName:[[details objectAtIndex:i] objectForKey:@"albumName"]
                                                 andSongLyrics:[[details objectAtIndex:i] objectForKey:@"lyrics"]];
        
        [dlSongsArr addObject:dlSong];
    }
    
    

}

#pragma mark - NewsFeed

- (NSArray*)newsFeeds{

    return newsFeedArr;
}

- (void)newsFeedDetails:(NSDictionary*)details{
    
    newsFeedArr = [NSMutableArray array];

    for (int i = 0; i < [[details objectForKey:@"Article"] count]; i++) {
        
        NewsFeed *newsFeed = [NewsFeed newsFeedArticleWithID:[[[details objectForKey:@"Article"] objectAtIndex:i] objectForKey:@"Article ID"]
                                                    andImage:[[[details objectForKey:@"Article"] objectAtIndex:i] objectForKey:@"Article Image"]
                                                    andTitle:[[[details objectForKey:@"Article"] objectAtIndex:i] objectForKey:@"Article Title"]
                                              andDescription:[[[details objectForKey:@"Article"] objectAtIndex:i] objectForKey:@"Description"]
                                              andDateTracked:[[[details objectForKey:@"Article"] objectAtIndex:i] objectForKey:@"datetracked"]];
        
        [newsFeedArr addObject:newsFeed];
        
        
    }
}

#pragma mark - Top Downloaded

- (NSArray *)topDownloadeds{

    return topDownloadedArr;
}

- (void)topDownloaded:(NSDictionary *)details{

    topDownloadedArr = [NSMutableArray array];
    
    for (int i = 0; i < [[details objectForKey:@"Songs"] count]; i++) {
        
        TopDownloaded *topDownloaded = [TopDownloaded topDownloadedWithAlbumID:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album ID"]
                                                                  andDownloads:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Downloads"]
                                                                      andLikes:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Like"]
                                                                       andPath:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Path"]
                                                                    andRatings:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"ratings"]
                                                                     andShares:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Share"]
                                                                     andSongID:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song ID"]
                                                                   andSongName:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Name"]
                                                                        andImg:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album Image"]
                                                                 andArtistName:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Artist Name"]
                                                                      andPrice:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Price"]
                                                                   andFileSize:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Size"]
                                                                  andDurations:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"duration"]
                                                                  andAlbumName:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album Name"]
                                                                andSongPreview:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Preview"]
                                                                 andSongLyrics:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Lyrics"]];
        
        [topDownloadedArr addObject:topDownloaded];
        
    }


}

#pragma mark - Top Favorites

- (NSArray *)topFavorites{
    
    return topFavoritesArr;
}

- (void)topFavorites:(NSDictionary *)details{
    
    topFavoritesArr = [NSMutableArray array];
    
    for (int i = 0; i < [[details objectForKey:@"Songs"] count]; i++) {
        
        Favorites *topFavorites = [Favorites topDownloadedWithAlbumID:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album ID"]
                                                                  andDownloads:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Downloads"]
                                                                      andLikes:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Like"]
                                                                       andPath:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Path"]
                                                                    andRatings:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Ratings"]
                                                                     andShares:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Share"]
                                                                     andSongID:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song ID"]
                                                                   andSongName:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Name"]
                                                                        andImg:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album Image"]
                                   
                                                                    andFeatureArtistName:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Artist Name"]
                                                             andPrice:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Price"]
                                                          andFileSize:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Size"]
                                                         andDurations:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"duration"]
                                                         andAlbumName:[[[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album Name"]
                                                       andSongPreview:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Song Preview"]
                                                        andSongLyrics:[[[details objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Lyrics"]];
        
        [topFavoritesArr addObject:topFavorites];
        
    }
    
    
}



- (NSArray*)schedules{

    return schedulesArr;
}

- (void)schedules:(NSDictionary*)details{

    schedulesArr = [NSMutableArray array];
    
    for (int i = 0 ; i < [[details  objectForKey:@"Schedules"] count]; i++) {
        
        Schedules *sched = [Schedules schedulesWithArtistID:[details objectForKey:@"Artist ID"]
                                                andDateTime:[[[details objectForKey:@"Schedules"] objectAtIndex:i] objectForKey:@"Date and Time"]
                                               andEventName:[[[details objectForKey:@"Schedules"] objectAtIndex:i] objectForKey:@"Event Name"]
                                                andLocation:[[[details objectForKey:@"Schedules"] objectAtIndex:i] objectForKey:@"Location"]];
        
        [schedulesArr addObject:sched];
        
    }
    
   // NSLog(@"Schedules = %@", schedulesArr);

}

#pragma mark - Photos

- (NSArray*)photos{

    return photosArr;
}

- (void)photos:(NSDictionary*)details{

    photosArr = [NSMutableArray array];
    
    for (int i = 0 ; i < [[details objectForKey:@"Photos"] count]; i++) {
        
        Photos *photo = [Photos artistID:[details objectForKey:@"Artist ID"]
                             andPhotoStr:[[[details objectForKey:@"Photos"] objectAtIndex:i] objectForKey:@"Image"]];
        
        [photosArr addObject:photo];
        
    }
}

#pragma mark - Events

- (NSArray*)events{
    return eventDetailArr;
}

- (void)events:(NSDictionary*)details{
    
    eventDetailArr = [NSMutableArray array];
    
    for (int a = 0; a < [[details objectForKey:@"EventsProp"] count]; a++) {
        
        Events *event = [Events eventWithID:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_id"]
                         
                         
                                    andName:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_name"]
                         
                         
                             andDescription:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_desc"]
                         
                         
                                andLocation:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_location"]
                         
                         
                                    andDate:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_date"]
                         
                         
                                   andImage:[[[details objectForKey:@"EventsProp"] objectAtIndex:a] objectForKey:@"event_image"]];
        
        [eventDetailArr addObject:event];
    }
    
}


#pragma mark - Song Comment Parser 

- (NSArray*)songComments{

    return songCommentArr;
}

- (void)songComment:(NSDictionary*)details{

    songCommentArr = [NSMutableArray array];
    
    for (int i = 0; i < [[details objectForKey:@"Comment"] count]; i++) {
        
        Comments *comments = [Comments commentWithName:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Name"]
                                            andComment:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Comment"]
//<<<<<<< .mine
//                                                andImg:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Image"]
//                                               andDate:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Date Time"]];
//=======
                                                andImg:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Image"]
                               andTime:[[[details objectForKey:@"Comment"] objectAtIndex:i] objectForKey:@"Date Time"]];
//>>>>>>> .r191
        
        [songCommentArr addObject:comments];
        
    }
}


- (NSArray*)newArtist{
    
    return newArtistDetailArr;
    
}

- (void)getNewArtist:(NSDictionary*)newArtistDetail{
    
    newArtistDetailArr = [NSMutableArray array];
    
    for (int i = 0; i < [[newArtistDetail objectForKey:@"Artist"] count]; i++) {
        
        NewArtist *newArtist = [NewArtist parseAlbumId:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Artist ID"]
                                           andFullName:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"FullName"]
                                         andScreenName:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Screen Name"]
                                         andArtistDesc:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Artist Description"]
                                              andImage:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Pic"]
                                             andRating:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Ratings"]
                                              andSongs:[[[newArtistDetail objectForKey:@"Artist"] objectAtIndex:i] objectForKey:@"Songs"]];
        
        [newArtistDetailArr addObject:newArtist];
        
        
      
    }
    
}



#pragma mark - New Songs

- (NSArray*)newSongs{
    
    return newSongsDetailArr;
    
}


- (void)getNewSongs:(NSDictionary*)newSongsDetail{
    
    newSongsDetailArr = [NSMutableArray array];
    
    for (int i = 0; i < [[newSongsDetail objectForKey:@"Songs"] count]; i++) {
        
        NewSongs *newSong = [NewSongs getSongId:[[[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album ID"]
                                     andAlbumId:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Song ID"]
                                    andSongName:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Song Name"]
                                     andPathImg:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Path"]
                                      andRating:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Ratings"]
                                    andDownload:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Downloads"]
                                        andLike:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Like"]
                                       andShare:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Share"]
                                  andArtistName:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Artist Name"]
                                    andDuration:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Duration"]
                                    andFileSize:[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i]  objectForKey:@"Song Size"]
                                    andAlbumImg:[[[[[newSongsDetail objectForKey:@"Songs"] objectAtIndex:i] objectForKey:@"Album ID"] objectAtIndex:0] objectForKey:@"Album Image"]];
        
        [newSongsDetailArr addObject:newSong]; 
    
    }
    
    
}


#pragma mark - Feature Artist

- (NSArray*)featuredArtist{
    
    return featuredArtistDetailArr;
    
}

- (void)getFeaturedArtist:(NSDictionary*)featuredArtistDetail{
    
    featuredArtistDetailArr = [NSMutableArray array];
    
    
    for (int i = 0; i < [[featuredArtistDetail objectForKey:@"Featured Artist"] count]; i++) {
       
        
//        [[[[[[[[[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Schedules"] objectAtIndex:0] objectForKey:@"Event Name"] objectForKey:@"Photo"] objectAtIndex:0] objectForKey:@"Image"] objectForKey:@"Album"] objectAtIndex:0] objectForKey:@"Album ID"]
        
        
//        objectForKey:@"Schedules"] objectAtIndex:0] objectForKey:@"Event Name"] objectForKey:@"Photos"] objectAtIndex:0] objectForKey:@"Image"] objectForKey:@"Album"] objectAtIndex:0] objectForKey:@"Album ID"]
        
        
//        [[[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Album"] objectAtIndex:0] objectForKey:@"Album ID"]
//        
//        
//        [[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Album"]
        
        FeatureArtist *featuredArtist = [FeatureArtist getFeatureArtist:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Artist ID"]
                                                            andFullName:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Full Name"]
                                                          andScreenName:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Screen Name"]
                                                         andDescription:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Description"]
                                                      andProfilePicture:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Profile Picture"]
                                                          andAlbumCount:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Album Count"]
                                                           andSchedules:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Schedules"]
                                                               andPhoto:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Photos"]
                                                               andAlbum:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Album"]
                                                           andEventName:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Event Name"]
                                                         andDateAndTime:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Date and Time"]
                                                            andLocation:[[[featuredArtistDetail objectForKey:@"Featured Artist"] objectAtIndex:i] objectForKey:@"Location"]];
        
        
        [featuredArtistDetailArr addObject:featuredArtist];
        
    }
    
    
}


- (NSArray*)featuredSong{
    
    return featuredSongDetailArr;
}


- (void)getFeaturedSong:(NSDictionary*)featuredSongDetail{
    
    featuredSongDetailArr = [NSMutableArray array];
    
    for (int i = 0; i < [[featuredSongDetail objectForKey:@"Featured Songs"] count]; i++) {
        FeaturedSongs *featuredSong = [FeaturedSongs getFeaturedSong:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song ID"]
                                                         andSongName:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Name"]
                                                     andSongLocation:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Location"]
                                                         andDuration:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Duration"]
                                                           andRating:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Ratings"]
                                                         andDownload:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Downloads"]
                                                         andSongSize:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Size"]
                                                             andLike:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Likes"]
                                                            andShare:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Shares"]
                                                            andPrice:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Price"]
                                                          andComment:[[[featuredSongDetail objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Comments"]];
        
        
        [featuredSongDetailArr addObject:featuredSong];
        
    }
    
}



- (NSArray*)albumFeautredSongDetails{
    
    return songDetailsArr;
    
}


- (void)albumFeautredSongtDetails:(NSDictionary*)details andIndex:(NSInteger)idx{
    
    songDetailsArr = [NSMutableArray array];
    
    for (int i = 0; i < [[details objectForKey:@"Featured Songs"] count]; i++) {
        
        Songs *song = [Songs songsWithID:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song ID"]
                                 andName:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Name"]
                             andLocation:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Location"]
                            andDurations:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Duration"]
                              andRatings:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Ratings"]
                            andDownloads:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Downloads"]
                                andLikes:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Likes"]
                               andShares:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Shares"]
                             andFileSize:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Size"]
                                andPrice:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Price"]
                          andSongPreview:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Song Preview"]
                               andLyrics:[[[details objectForKey:@"Featured Songs"] objectAtIndex:i] objectForKey:@"Lyrics"]];
        
        
        [songDetailsArr addObject:song];
    }

    
}


#pragma mark Home Detail

- (NSArray*)homeDataInterface{
    
    return homeDataInterfaceDetailArr;
    
}


- (void)gethomeDataInterface:(NSDictionary*)homeDataInterfaceDetail{
    
    homeDataInterfaceDetailArr = [NSMutableArray array];
    
    
    for (int i = 0; i < [homeDataInterfaceDetail count]; i++) {
        
        HomeData *homeData = [HomeData getAds:[homeDataInterfaceDetail objectForKey:@"Ads"]
                              andArtistOfTheMonth:[homeDataInterfaceDetail objectForKey:@"Artist of the Month"]
                                andArtistName:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Artist Name"]
                             andArtistPicture:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Artist Pic"]
                     andFeaturedArtistPicture:[homeDataInterfaceDetail objectForKey:@"Featured Artist Pic"]
                       andFeaturedSongPicture:[homeDataInterfaceDetail objectForKey:@"Featured Song Pic"]
                          andNewArtistPicture:[homeDataInterfaceDetail objectForKey:@"New Artist Pic"]
                            andNewSongPicture:[homeDataInterfaceDetail objectForKey:@"New Song Pic"]
                                    andAdsPic:[[[homeDataInterfaceDetail objectForKey:@"Ads"] objectAtIndex:0] objectForKey:@"Ads Image"]
                                   andAdsLink:[[[homeDataInterfaceDetail objectForKey:@"Ads"] objectAtIndex:0] objectForKey:@"Ads Link"]
                                   andAOTMPic:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Artist Pic"]
                              andArtistID:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Artist ID"]
                         andArtistDescription:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Description"]
                          andArtistScreenName:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Screen Name"]
                                 andArtistAge:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Age"]
                               andArtistGenre:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Genre"]
                                   andMembers:[[[homeDataInterfaceDetail objectForKey:@"Artist of the Month"] objectAtIndex:0] objectForKey:@"Members"]];
        
        [homeDataInterfaceDetailArr addObject:homeData];
        
    }
    
}


#pragma mark - Listened Songs

- (void)getListenedSongs:(NSMutableArray*)details{
    
    songListedArr = [NSMutableArray array];

    for (int i = 0; i < [details count]; i++) {
        
        
        ListenedSongs *listenedSongs = [ListenedSongs songListenedWithName:[[details objectAtIndex:i] objectForKey:@"songName"] andUserID:[[details objectAtIndex:i] objectForKey:@"userID"]];
        
        [songListedArr addObject:listenedSongs];
        
    }

}

- (NSArray*)songListened{

    return songListedArr;

}

- (void)getPlayListData:(NSMutableArray*)data{

    for (int i = 0; i < [data count]; i++) {
        
        PlayListData *playListData = [PlayListData artistName:[[data objectAtIndex:i] objectForKey:@"artistName"] andAlbumName:[[data objectAtIndex:i] objectForKey:@"albumName"]];
        
        [playListDataArr addObject:playListData];
    
    }
    
}

- (NSArray*)playListData{

    return playListDataArr;
}

- (void)getAlbumName:(NSString*)albumName{

    albumNameStr = albumName;
    
}
- (NSString*)albumName{

    return albumNameStr;
}

- (void)getType:(NSString*)type{

    typeStr = type;
}

- (NSString*)type{

    return typeStr;
}

- (void)getDownloadingData:(NSMutableArray*)data{

    downloadingArr = data;
    
    
//    downloadingArr addObject:data
  
    
    NSLog(@"downloadingArr = %@", downloadingArr);
    NSLog(@"downloadingArr count = %i", [downloadingArr count]);
}

- (NSArray*)downloadingDatas{

    return downloadingArr;
}

- (void)emptyData{
    userDetailsArr = nil;
    dlSongsArr = nil;
    
}

- (NSString*)imgAlbum{

    return strImg;
}

- (void)getImgStr:(NSString*)imgStr{

    strImg = imgStr;
}

- (NSString*)artistName{

    return artistNameStr;
}

- (void)getArtistName:(NSString*)artistName{
    
    artistNameStr = artistName;
    
}

- (NSString*)artistImg{
    
    return artistImgStr;
}

- (void)getArtistImg:(NSString*)imgStr{
    
    artistImgStr = imgStr;
}

- (NSString*)artistID{
    
    return artistIDStr;
}

- (void)getArtistID:(NSString*)artistID{
    
    artistIDStr = artistID;
}

- (void)getAlbumID:(NSString*)albumID{

    albumIDStr = albumID;
}
- (NSString*)albumID{

    return albumIDStr;
}

#pragma mark - Empty Data

- (void)emptyArtist{
    
    artistDetailsArr = nil;
}

- (void)emptyAlbum{
    
    albumDetailsArr = nil;
}

- (void)emptySong{
    
    songDetailsArr = nil;
}

- (void)emptyDlSong{
    
    dlSongsArr = nil;
}

- (void)emptyNewsFeed{
    
    newsFeedArr = nil;
}

- (void)emptyTopDownloaded{
    
    topDownloadedArr = nil;
}

- (void)emptyEvent{
    
    eventDetailArr = nil;
}

- (void)emptyTopFavorites{
    
    topFavoritesArr = nil;
}

- (void)emptySchedules{
    
    schedulesArr = nil;
}

- (void)emptyPhotos{
    
    photosArr = nil;
}


#pragma mark - SingleTon

+ (ParserClass *)sharedItems
{
    if (sharedItem == nil) {
        sharedItem = [[super allocWithZone:NULL]init];
    }
    return  sharedItem;
}
- (id)init{
    if ((self = [super init])) {
        
    }
    return self;
}
+ (id)allocWithZone:(NSZone *)zone{
    return  [self sharedItems];
}
- (id)copyWithZone:(NSZone *)zone{
    return self;
}

@end
